class AsyncPlugin {
  apply(compiler){
    compiler.hooks.emit.tapAsync('AsyncPlugin', (compilation,cb)=>{
      setTimeout(()=>{
        console.log('异步勾子，间隔2秒完成');
        cb()
      },2000)
    })

    compiler.hooks.emit.tapPromise('AsyncPlugin',(compilation)=>{
      return new Promise((resolve,reject)=>{
        setTimeout(()=>{
          console.log('promise勾子，间隔一秒执行');
          resolve()
        },1000)
      })
    })
  }
}
module.exports = AsyncPlugin